#include<iostream>

using namespace std;

int partion(int* a, int l, int r)
{
	int tem = a[r];
	int i = l, j = r;
	while (i < j)
	{
		while (i < j && a[i] <= tem) i++;
		while (i < j && a[j] >= tem) j--;
		if (i < j) swap(a[i], a[j]);
		else swap(a[i], a[r]);
	}
	return i;
}


void QuickSort(int* a, int l, int r)
{
	if (l < r)
	{
		int mid = partion(a, l, r);
		QuickSort(a, l, mid - 1);
		QuickSort(a, mid + 1, r);
	}
}

//int main()
//{
//	int a[1000];
//	int n; cin >> n;
//	for (int i = 1; i <= n; i++)cin>>a[i];
//	int l = 0, r = n;
//	QuickSort(a, l, r);
//	return 0;
//}
const int N = 15;
int vis[N][N];
int n, ans;
void dfs(int deep)
{
	if (deep == n + 1) {
		ans++;
		return;
	}
	for (int i = 1; i <= n; i++) {
		if (vis[deep][i]) continue;
		for (int _i = deep; _i <= n; _i++) vis[_i][i]++;
		for (int _i = deep, _j = i; _i <= n && _j <= n; _i++, _j++) vis[_i][_j]++;
		for (int _i = deep, _j = i; _i >= 1 && _j <= n; _i--, _j++) vis[_i][_j]++;
		for (int _i = deep, _j = i; _i <= n && _j >= 1; _i++, _j--) vis[_i][_j]++;
		for (int _i = deep, _j = i; _i >= 1 && _j >= 1; _i--, _j--) vis[_i][_j]++;

		dfs(deep + 1);

		for (int _i = deep; _i <= n; _i++) vis[_i][i]--;
		for (int _i = deep, _j = i; _i <= n && _j <= n; _i++, _j++) vis[_i][_j]--;
		for (int _i = deep, _j = i; _i >= 1 && _j <= n; _i--, _j++) vis[_i][_j]--;
		for (int _i = deep, _j = i; _i <= n && _j >= 1; _i++, _j--) vis[_i][_j]--;
		for (int _i = deep, _j = i; _i >= 1 && _j >= 1; _i--, _j--) vis[_i][_j]--;


	}
}

int main()
{
	cin >> n;
	dfs(1);
	cout << ans << endl;
	return 0;
}